package jsen.tool.ddd.adapter.infrastructure.specification.demo.spec.send;

import jsen.tool.ddd.adapter.infrastructure.specification.ISpecification;
import jsen.tool.ddd.adapter.infrastructure.specification.base.Sdl;
import jsen.tool.ddd.adapter.infrastructure.specification.base.SdlSpecificationSupplier;
import jsen.tool.ddd.adapter.infrastructure.specification.demo.SendMethod;

/**
 * 如果手工组装，组装的原则是从小到大（从最内部的括号开始往外组装）
 *
 * @author jsen
 * @date 2021/10/6
 */
public class SendMethodSpecFactory {
    public static ISpecification<SendMethod> buildSpec() {
        SdlSpecificationSupplier factory = new SdlSpecificationSupplier();
        factory.register("nameMustDiffWithAlias", SendMethodNameSpec::new);

        String sdl = "nameMustDiffWithAlias";
        return new Sdl<SendMethod>(sdl, factory).and(SendMethod::getAge, new SendMethodAgeSpec())
                .and(SendMethod::getLine, new SendMethodLineSpec());
    }
}
